package com.wuliu.servlet;

import com.wuliu.dao.BusinessClassDAO;
import com.wuliu.dao.BusinessDAO;
import com.wuliu.dao.SecondImageDAO;
import com.wuliu.dao.impl.BusinessClassDAOImpl;
import com.wuliu.dao.impl.BusinessDAOImpl;
import com.wuliu.dao.impl.SecondImageDAOImpl;
import com.wuliu.model.Business;
import com.wuliu.model.BusinessClass;
import com.wuliu.model.SecondImage;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet("/page2")
public class OurServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        BusinessClassDAO businessClassDAO= new BusinessClassDAOImpl();
        List<BusinessClass> businessClasses =businessClassDAO.findAll();
        req.setAttribute("businessClasses",businessClasses);


        SecondImageDAO secondImageDAO =new SecondImageDAOImpl();
        List<SecondImage> secondImages =secondImageDAO.findAll();
        req.setAttribute("secondImages",secondImages);

        BusinessDAO businessDAO=new BusinessDAOImpl();
        List<Business> businesses =businessDAO.findAll();
        req.setAttribute("businesses",businesses);

        req.getRequestDispatcher("/WEB-INF/view/our.jsp").forward(req,resp);

    }
}
